home *** CD-ROM | disk | FTP | other *** search
- #include<io.h>
- #include<errno.h>
- #include<dos.h>
- #include"redirector.h"
-
- /*******************************************************************
- * lock_write() - write shared data to a network file
- *
- * Parameters:
- * handle (in) - file handle to read from
- * buffer (in) - buffer to place data in
- * length (in) - number of bytes to read
- *
- * Returns:
- * Return code is identical to write()
- *
- * Notes:
- * 1. This routine assumes that the record to be written
- * was previously read using lock_read().
- *
- * History:
- * Original code by William H. Roetzheim, 1989
- **********************************************************************/
-
- int lock_write(int fh, char *buffer, unsigned int length)
- {
- int count;
-
- count = write(fh, buffer, length); /* write data out */
- unlock(fh, lseek(fh, -length, SEEK_CUR), length);
-
- return count;
- }